package com.ruoyi.abuwx.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.abuwx.domain.AbuwxSchedule;
import com.ruoyi.abuwx.service.IAbuwxScheduleService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 进度Controller
 * 
 * @author tang
 * @date 2022-07-12
 */
@RestController
@RequestMapping("/abuwx/AbuwxSchedule")
public class AbuwxScheduleController extends BaseController
{
    @Autowired
    private IAbuwxScheduleService abuwxScheduleService;

    /**
     * 查询进度列表
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxSchedule:list')")
    @GetMapping("/list")
    public TableDataInfo list(AbuwxSchedule abuwxSchedule)
    {
        startPage();
        List<AbuwxSchedule> list = abuwxScheduleService.selectAbuwxScheduleList(abuwxSchedule);
        return getDataTable(list);
    }

    /**
     * 导出进度列表
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxSchedule:export')")
    @Log(title = "进度", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AbuwxSchedule abuwxSchedule)
    {
        List<AbuwxSchedule> list = abuwxScheduleService.selectAbuwxScheduleList(abuwxSchedule);
        ExcelUtil<AbuwxSchedule> util = new ExcelUtil<AbuwxSchedule>(AbuwxSchedule.class);
        util.exportExcel(response, list, "进度数据");
    }

    /**
     * 获取进度详细信息
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxSchedule:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(abuwxScheduleService.selectAbuwxScheduleById(id));
    }

    /**
     * 新增进度
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxSchedule:add')")
    @Log(title = "进度", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AbuwxSchedule abuwxSchedule)
    {
        return toAjax(abuwxScheduleService.insertAbuwxSchedule(abuwxSchedule));
    }

    /**
     * 修改进度
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxSchedule:edit')")
    @Log(title = "进度", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AbuwxSchedule abuwxSchedule)
    {
        return toAjax(abuwxScheduleService.updateAbuwxSchedule(abuwxSchedule));
    }

    /**
     * 删除进度
     */
    @PreAuthorize("@ss.hasPermi('abuwx:AbuwxSchedule:remove')")
    @Log(title = "进度", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(abuwxScheduleService.deleteAbuwxScheduleByIds(ids));
    }
}
